#!/usr/bin/python
#-*- coding: UTF-8

import sys

from coldata import *


def usage():
	print 'usage: ' + sys.argv[0] + ' [CODEPOINTS] [CONTRACTIONS]'
	print
	print '[CODEPOINTS]   - filename with list of codepoints'
	print '[CONTRACTIONS] - filename with list of contractions from the same collation'


if __name__ == '__main__':
	if len(sys.argv) < 3:
		usage()
		sys.exit(1)

	codepoints_file, contractions_file = sys.argv[1], sys.argv[2]
	codepoints, _ = collect_contractions(codepoints_file, contractions_file)  # codepoints already reweighted

	for c, w in codepoints:
		print ' '.join(c), '%06X' % (w)
